package com.example.wm.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.wm.common.Result;
import com.example.wm.common.ResultData;
import com.example.wm.entity.Personaralationship;
import com.example.wm.service.PersonrelationshipService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/Personrelationship")
public class PersonrelationshipController {
@Resource
    private PersonrelationshipService personrelationshipService;
    @Transactional
    @PostMapping("/getbyid")

    public Result get(@RequestBody JSONObject jsonObject){
        LambdaQueryWrapper<Personaralationship> lq=new LambdaQueryWrapper<>();
        lq.eq(Personaralationship::getComponeyid,jsonObject.getString("id"));
          lq.orderByDesc(Personaralationship::getId);
        List<Personaralationship> list=personrelationshipService.list(lq);

        return ResultData.success("操作成功",list);
    }
}
